package homework;

/**
 * @classname:demo12
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/8 17:38
 * @version: 0.1
 * @since:1.8
 */
public class demo12 {
    public static void main(String[] args) {
        String str = "我我....我...我.要...要要...要学....学学..学.编..编编.编.程.程.程..程";
        String replacestr = str.replace(".", "");
        String regex = "(.)\\1+";
        String newstr = replacestr.replaceAll(regex, "$1");
        System.out.println(newstr);
    }
}
